package com.weishuang.monitor.employee.commons;

import java.text.SimpleDateFormat;
import java.time.*;
import java.util.Date;
import java.util.TimeZone;

public class LocalDateTimeUtils {

    /**
     *
     * @param localDateTime
     * @return
     */
    public static String getUtcToShanghaiDate(LocalDateTime localDateTime) {
        Instant instant = localDateTime.toInstant(ZoneOffset.UTC);
        Date from = Date.from(instant);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
        String format = simpleDateFormat.format(from);
        return format;
    }
}
